bitkeeper revision 1.1730 (42ba7dbdkTADQfBqHaC_Ynqo3i1ZVw)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Jun 2005 09:15:41 +0000 (09:15 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Jun 2005 09:15:41 +0000 (09:15 +0000)
The xc_domain_getinfo does not clear the info structure before filling
it in, and in some circumstances it doesn't completely fill in the
structure for each domain.  In particular, it sets the crashed flag if
the domain has crashed, but does not clear it if the domain has not
crashed, so the crashed flag may be random stack garbage from the
calling program.  With the attached patch (against the latest nightly),
xc_domain_getinfo zeroes the array of info structures before filling
them in.

Signed-off-by: Josh Triplett <josht@us.ibm.com>
tools/libxc/xc_domain.c

index 5ea0a33903c741bfea0b35be2ba02bc05de4714c..5cd6b43e8e809eebf37242fb5cad6d0c300f1ad8 100644 (file)
@@ -79,6 +79,8 @@ int xc_domain_getinfo(int xc_handle,
     dom0_op_t op;
     int rc = 0; 
 
+    memset(info, 0, max_doms*sizeof(xc_dominfo_t));
+
     for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
     {
         op.cmd = DOM0_GETDOMAININFO;